package com.cardone.platform.authority.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.authority.dao.UserGroupDao;
import com.cardone.platform.authority.dto.UserGroupDto;

/**
 * 用户组服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class UserGroupDefaultService implements UserGroupService {
	@Override
	public int deleteByIds(final UserGroupDto deleteUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).deleteByIds(deleteUserGroup);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final UserGroupDto findUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).findByCodeOrId(mappedClass, findUserGroup);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final UserGroupDto findUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).findById(mappedClass, findUserGroup);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final UserGroupDto findListUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).findListByLikeCode(mappedClass, findListUserGroup);
	}

	@Override
	public int insertByCode(final UserGroupDto insertUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).insertByCode(insertUserGroup);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final UserGroupDto paginationUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).paginationByLikeCode(mappedClass, paginationUserGroup);
	}

	@Override
	public Integer readByCodeNqIdForCount(final UserGroupDto readUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).readByCodeNqIdForCount(readUserGroup);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final UserGroupDto saveUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).saveByIdOrCode(mappedClass, saveUserGroup);
	}

	@Override
	public int updateByCode(final UserGroupDto updateUserGroup) {
		return ContextHolder.getBean(UserGroupDao.class).updateByCode(updateUserGroup);
	}
}